import request from '@/utils/request.js'

// 发布文章

const publishArticle = (publishForm,draft) =>{
    return request.post(`/mp/v1_0/articles?draft=${draft}`,publishForm)
}

// 加载文章详情

const getArticleDetail = (articleId) =>{
    return request.get(`/mp/v1_0/articles/${articleId}`)
}

// 修改文章

const updateArticle = (articleId, publishForm, draft = false) =>{
    return request({
      method: 'PUT',
      url: `/mp/v1_0/articles/${articleId}`,
      params: {
          draft
      },
      data:publishForm
    })
}
export {
    publishArticle,
    getArticleDetail,
    updateArticle
}